<template>
  <div style="height: 100vh; width: 100vw">
    <div class="topBack">
      <div class="textfull">
        <div style="display: flex; align-items: center">
          <img :src="logo" width="40px" height="40px" alt="" v-if="logo" />
          <p style="margin-left: 8px; color: #fff; font-size: 24px">
            {{ qyname.split("/")[0]
            }}{{ qyname.includes("/") ? qyname.split("/")[1] : "" }}
          </p>
        </div>
        <div
          style="
            width: 130px;
            display: flex;
            justify-content: space-between;
            color: #ddd;
          "
        >
          <a :href="http" style="color: #fff">返回首页</a>|<a
            :href="http + '/user'"
            style="color: #fff"
            >直接登录</a
          >
        </div>
      </div>
    </div>
    <div class="bodyFull" id="bodyFull">
      <div class="backFull">
        <div class="form" v-loading="loading">
          <h2>学习报名</h2>
          <div class="contentbox">
            <formItem label="培训工种" :requires="true">
              <div style="flex: 1; overflow: auto">
                <div style="white-space: nowrap">
                  <div
                    :class="`redioBtn ${gz == item ? 'redioactive' : ''}`"
                    v-for="(item, index) in GZList"
                    :key="item"
                    @click="gz = item"
                    :style="index == 0 ? '' : `margin-left: 12px;`"
                  >
                    {{ item }}
                  </div>
                </div>
              </div>
            </formItem>
            <ul>
              <li
                v-for="(item, index) in inputList"
                :key="index + 10002221111"
                style="display: flex; justify-content: space-between"
              >
                <formItem
                  :label="it.label"
                  :requires="it.selected"
                  :columns="true"
                  v-for="it in item"
                  :key="item.id"
                  :labelWidth="180"
                  style="width: 30%"
                  v-show="it.passShow"
                >
                  <el-input
                    v-if="
                      ['input', 'number', 'textarea'].includes(it.field_type)
                    "
                    v-model="formLabelAlign[it.field_id]"
                    :placeholder="it.hint ? it.hint : '请输入' + it.label"
                    @input="$forceUpdate()"
                  >
                  </el-input>
                  <cascader
                    v-else-if="['subject_id'].includes(it.field_id)"
                    :options="options[it.field_id]"
                    v-model="formLabelAlign[it.field_id]"
                    :placeholder="it.hint ? it.hint : '请输入' + it.label"
                    @change="changefiled"
                    :field_id="it.field_id"
                  >
                  </cascader>
                  <cascader
                    v-else-if="['region_id'].includes(it.field_id)"
                    :options="options[it.field_id]"
                    v-model="test"
                    @change="
                      (value, data) => {
                        formLabelAlign[it.field_id] = data.path.join(',');
                      }
                    "
                    :placeholder="it.hint ? it.hint : '请输入' + it.label"
                    :props="{
                      label: 'region_name',
                      value: 'region_id',
                      lazy: true,
                      lazyLoad: lazyLoad,
                    }"
                  >
                  </cascader>
                  <cascader
                    v-else-if="['cascader'].includes(it.field_type)"
                    :options="options[it.field_id]"
                    v-model="formLabelAlign[it.field_id]"
                    @change="changefiled"
                    :field_id="it.field_id"
                    :placeholder="it.hint ? it.hint : '请选择' + it.label"
                  >
                  </cascader>
                  <el-select
                    v-else-if="['select'].includes(it.field_type)"
                    v-model="formLabelAlign[it.field_id]"
                    :placeholder="it.hint ? it.hint : '请选择' + it.label"
                    @change="$forceUpdate()"
                  >
                    <el-option
                      v-for="item in options[it.field_id]"
                      :key="item"
                      :label="item"
                      :value="item"
                    >
                    </el-option>
                  </el-select>
                  <div
                    v-else-if="['datetimeRange'].includes(it.field_type)"
                    style="display: flex; align-items: center"
                    class="datetimeRange"
                  >
                    <el-date-picker
                      v-model="formLabelAlign[it.field_id][0]"
                      type="date"
                      value-format="yyyy-MM-dd"
                      placeholder="选择日期"
                      @click="
                        () => {
                          if (!formLabelAlign[it.field_id][0]) {
                            formLabelAlign[it.field_id][0] = null;
                          }
                        }
                      "
                      @blur="$forceUpdate()"
                      @change="$forceUpdate()"
                    >
                    </el-date-picker>
                    <span>至</span>
                    <el-input
                      v-model="formLabelAlign[it.field_id][1]"
                      v-if="formLabelAlign[it.field_id][1] == '至今'"
                      readonly
                      @click.native="clickInput(it)"
                    ></el-input>
                    <el-date-picker
                      v-else
                      v-model="formLabelAlign[it.field_id][1]"
                      type="date"
                      value-format="yyyy-MM-dd"
                      placeholder="选择日期"
                      ref="updataDatePicker"
                      @change="$forceUpdate()"
                      @blur="
                        () => {
                          if (!formLabelAlign[it.field_id][1]) {
                            formLabelAlign[it.field_id][1] = '至今';
                          }
                          $forceUpdate();
                        }
                      "
                    >
                    </el-date-picker>
                  </div>
                  <el-date-picker
                    v-else-if="['datetime'].includes(it.field_type)"
                    v-model="formLabelAlign[it.field_id]"
                    value-format="yyyy-MM-dd"
                    type="date"
                    :placeholder="item.hint"
                    @change="
                      () => {
                        $forceUpdate();
                      }
                    "
                    @blur="
                      () => {
                        $forceUpdate();
                      }
                    "
                  >
                  </el-date-picker>
                  <el-input
                    v-if="['input-btn'].includes(it.field_type)"
                    v-model="formLabelAlign[it.field_id]"
                    :placeholder="item.hint ? item.hint : '请输入' + it.label"
                    @input="$forceUpdate()"
                  >
                    <div slot="suffix">
                      <div
                        v-show="hascodeYes"
                        @click.stop="hoveCode"
                        style="
                          font-size: 10px;
                          background-color: #166aff;
                          color: #fff;
                          height: 30px;
                          width: 67px;
                          display: flex;
                          align-items: center;
                          justify-content: center;
                          position: absolute;
                          right: 0;
                          top: 0;
                          cursor: pointer;
                        "
                      >
                        发送验证码
                      </div>
                      <div
                        v-show="!hascodeYes"
                        style="
                          height: 30px;
                          width: 40px;
                          display: flex;
                          align-items: center;
                          justify-content: center;
                          position: absolute;
                          right: 0;
                          top: 0;
                          color: #000;
                        "
                      >
                        {{ codeTime }}s
                      </div>
                    </div>
                  </el-input>
                </formItem>
                <div
                  v-for="i in 3 - item.length"
                  :key="i + 99965"
                  style="margin-bottom: 16px; width: 30%"
                ></div>
              </li>
            </ul>
            <div
              v-for="item in fromList"
              :key="item.id + 28754847145"
              v-if="item.field_type == 'img'"
            >
              <formItem
                :label="item.label"
                :requires="item.selected"
                :columns="true"
                v-show="item.passShow"
              >
                <template>
                  <p
                    style="margin-bottom: 4px; font-size: 14px; color: #979797"
                  >
                    {{ item.hint }}
                  </p>
                  <upload
                    :type="item.field_id"
                    :label="item.label"
                    :zip="true"
                    @change="uploadChange"
                    v-if="item.field_id != 'id_card'"
                  >
                  </upload>
                  <div v-else style="display: flex">
                    <upload
                      type="id_card_photo"
                      label="身份证人像面"
                      :zip="true"
                      @change="uploadChange"
                    >
                    </upload>
                    <upload
                      style="margin-left: 12px"
                      type="id_card_emblem"
                      label="身份证国徽面"
                      :zip="true"
                      @change="uploadChange"
                    >
                    </upload>
                  </div>
                </template>
              </formItem>
            </div>
            <div
              style="width: 375px"
              v-for="(item, index) in fromList"
              :key="index + 2875484"
              v-if="['sign', 'autowrite'].includes(item.field_type)"
            >
              <formItem
                :label="item.label"
                :requires="item.selected"
                :columns="true"
                v-show="item.passShow"
              >
                <sign
                  :field_id="item.field_id"
                  :field_type="item.field_type"
                  v-model="showsign"
                  @update="
                    ({ signsrc, signature }) => {
                      formLabelAlign[item.field_id] = signsrc;
                      formLabelAlign.signature = signature;
                    }
                  "
                  @openSign="openSign(item, $event)"
                  :formLabelAlign="formLabelAlign"
                  :subjectTittle="subjectTittle"
                ></sign>
              </formItem>
            </div>
            <formItem
              v-for="(item, index) in fromList"
              :key="index + 105202875484"
              v-if="['download'].includes(item.field_type)"
              :label="item.label"
              :requires="item.selected"
              :columns="true"
              v-show="item.passShow"
            >
              <div
                style="
                  display: flex;
                  width: 100%;
                  height: 40px;
                  align-items: center;
                "
              >
                <div
                  style="
                    width: 375px;
                    height: 40px;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    color: #fff;
                    background: #166aff;
                    border-radius: 4px;
                    cursor: pointer;
                  "
                  @click="downFuled(item.others.appendix)"
                >
                  附件下载
                </div>
              </div>
            </formItem>
            <div
              style="
                padding-top: 16px;
                width: 100%;
                border-top: 1px #eee solid;
                text-align: center;
              "
            >
              <el-button
                @click="commit"
                type="primary"
                style="
                  padding: 6px 40px;
                  background: #166aff;
                  border-color: #166aff;
                  font-size: 16px;
                "
              >
                提交
              </el-button>
            </div>
          </div>
        </div>
      </div>
    </div>
    <el-dialog title="提示" :visible.sync="tipShow" width="30%">
      <el-input
        v-model="str"
        type="textarea"
        placeholder="请输入内容"
        :autosize="{ minRows: 2 }"
        resize="none"
        :readonly="true"
      ></el-input>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="tipShow = false">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
import apply from "@/components/model3.0/apply.js";
import formItem from "@/components/formItem/index3.0.vue";
import cascader from "@/components/cascader3.0/index.vue";
import upload from "@/components/Upload3.0/upload-web.vue";
import sign from "@/components/sign3.0/index-web.vue";
import {
  applyList,
  applyAdd,
  subjectList,
  regionList,
  H5Pay,
  H5PayList,
  maPay,
  qrcode,
  sendcode,
  axios,
  photoMake,
  Department,
} from "@/api/apply.js";
import { download } from "@/api/download.js";
export default {
  components: { formItem, cascader, upload, sign },
  computed: {
    ...mapGetters(["init", "http"]),
    inputList() {
      console.log(this.fromList, "8989");

      let arr = this.fromList.filter(
        (item) =>
          [
            "select",
            "input",
            "number",
            "textarea",
            "datetime",
            "datetimeRange",
          ].includes(item.field_type) && item.passShow
      );
      if (
        this.platform("hzdpx") ||
        this.platform("qiye") ||
        this.platform("xtaq") ||
        (this.platform("zcaq") && this.formLabelAlign.gz == "大培训")
      ) {
        arr.push({
          label: "验证码",
          field_type: "input-btn",
          field_id: "codeChk",
          selected: 1,
          passShow: true,
        });
      }
      if (
        (this.platform("bosheng") &&
          this.formLabelAlign.gz == "燃气从业人员培训") ||
        this.platform("qiye")
      ) {
        arr.push({
          label: "燃气主管部门",
          field_type: "cascader",
          field_id: "dep",
          selected: 0,
          passShow: true,
        });
      }
      let list = [[]];
      let num = 0;
      arr.map((item, index) => {
        if (index % 3 == 0 && index != 0) {
          num = index / 3;
          list[num] = [];
        }
        list[num].push(item);
      });
      return list;
    },
  },
  data() {
    return {
      loading: false,
      fromList: [], //后台返回的需要填写的字段
      formLabelAlign: {}, //提交的数据
      GZList: [], //工种列表
      gz: "",
      // subjectListTree:[],
      options: {}, //所有select组件的option
      setting: "", //后台设置
      subjectTittle: "",
      showsign: "",
      codeTime: 60,
      hascodeYes: true,
      subjectItem: {}, //当前选中的科目信息
      qyname: "",
      logo: "",
      tipShow: false,
      str: "",
      test: "",
    };
  },
  watch: {
    gz(val) {
      let value = val;
      if (val == "危化品" || val == "高危安管") {
        value = "安全管理";
      }
      if (val == "一般行业") {
        value = "一般工贸";
      }
      this.fromList = [];
      this.formLabelAlign = { gz: value };
      this.applyListData(value);
    },
  },
  methods: {
    ...apply.methods,
    changefiled(value, data) {
      this.subjectTittle = data.pathLabels[0];
      this.formLabelAlign.subject_ids = data.path.join(",");
      this.subjectItem = data.data;
      this.formLabelAlign.exam_type = data.pathLabels.join("/").includes("复审")
        ? "复审"
        : "初培";
      this.fromList.map((item) => {
        item.passShow = true;
        if (item.field_id == "last_cert") {
          if (this.formLabelAlign.exam_type.indexOf("初培") != -1) {
            item.passShow = false;
          } else {
            item.passShow = true;
          }
        }
        if (this.gz == "特种作业") {
          if (this.platformAnhui() || this.platform("qiye")) {
            if (item.field_id == "last_cert") {
              if (this.formLabelAlign.exam_type.indexOf("初培") != -1) {
                item.passShow = false;
              } else {
                item.passShow = true;
              }
            }
            if (item.field_id == "qzsj") {
              if (this.formLabelAlign.exam_type.indexOf("初培") != -1) {
                item.passShow = false;
              } else {
                item.passShow = true;
              }
            }
          } else if (!this.platform("lyjc")) {
            if (item.label == "现持证书信息") {
              if (this.formLabelAlign.exam_type.indexOf("初培") != -1) {
                item.passShow = false;
              } else {
                item.passShow = true;
              }
            }
            if (item.label == "户口本" || item.label == "毕业证") {
              if (this.formLabelAlign.exam_type.indexOf("复审") != -1) {
                item.passShow = false;
              } else {
                item.passShow = true;
              }
            }
          }
        }
        if (this.gz == "一般工贸") {
          if (this.platformAnhui()) {
            if (item.field_id == "last_cert") {
              //初培证书
              if (this.formLabelAlign.exam_type.indexOf("初培") != -1) {
                item.passShow = false;
              } else {
                item.passShow = true;
              }
            }
            if (item.field_id == "qzsj") {
              if (this.formLabelAlign.exam_type.indexOf("初培") != -1) {
                item.passShow = false;
              } else {
                item.passShow = true;
              }
            }
          } else {
            if (item.label == "安全合格证证号" || item.label == "截止日期") {
              if (this.formLabelAlign.exam_type.indexOf("初培") != -1) {
                item.passShow = false;
              } else {
                item.passShow = true;
              }
            }
          }
        }
        if (this.gz == "安全管理" || this.gz == "高危安管") {
          if (this.platformAnhui()) {
            if (item.field_id == "zhicheng") {
              if (subject.indexOf("危险化学品生产单位") != -1) {
                item.passShow = true;
              } else {
                item.passShow = false;
              }
            }
            if (item.field_id == "edu_photo") {
              if (subject.indexOf("危险化学品生产单位") != -1) {
                item.hint =
                  "毕业证和职称证选一个进行上传，须化工专业大专或中级职称以上证书";
              } else {
                item.hint = "毕业证和户口本选一个进行上传";
              }
            }
          }
          if (item.field_id == "qzsj") {
            if (this.formLabelAlign.exam_type.indexOf("初培") != -1) {
              item.passShow = false;
            } else {
              item.passShow = true;
            }
          }
        }
        if (this.gz == "职业卫生") {
          if (this.platform("ataq")) {
            if (item.field_id == "training_record") {
              if (this.formLabelAlign.exam_type.indexOf("初培") != -1) {
                item.passShow = false;
              } else {
                item.passShow = true;
              }
            }
          }
        }
        if (this.platform("yuhua")) {
          if (item.field_id == "edu_photo") {
            if (this.formLabelAlign.exam_type.indexOf("复审") != -1) {
              item.passShow = false;
            } else {
              item.passShow = true;
            }
          }
        }

        if (this.gz == "燃气从业人员培训" && this.platform("bosheng")) {
          if (item.field_id == "qzsj") {
            if (data.pathLabels.includes("新取证")) {
              item.passShow = false;
            } else {
              item.passShow = true;
            }
          }
          if (item.field_id == "cert_number") {
            if (data.pathLabels.includes("新取证")) {
              item.passShow = false;
            } else {
              item.passShow = true;
            }
          }
        }
      });
      this.$forceUpdate();
      this.formLabelAlign[data.field_id] = value;
      this.fromList.push({
        filed_id: "88",
      });

      this.fromList.pop();
    },
    commit() {
      let formLabelAlign = JSON.parse(JSON.stringify(this.formLabelAlign));
      this.fromList.map((item) => {
        if (item.fitaber) {
          if (formLabelAlign[item.field_id]) {
            formLabelAlign[item.fitaber][item.field_id] =
              formLabelAlign[item.field_id];
          } else {
            formLabelAlign[item.fitaber][item.field_id] = "";
          }
          delete formLabelAlign[item.field_id];
        }
        if (item.field_type == "datetimeRange") {
          formLabelAlign[item.field_id] =
            formLabelAlign[item.field_id].join(",");
        }
      });
      delete formLabelAlign.id_card;
      console.log(formLabelAlign, "999999");
      if (this.platform("yali")) {
        if (formLabelAlign.gz == "危化品") {
          formLabelAlign.gz = "安全管理";
        }
        if (formLabelAlign.gz == "一般行业") {
          formLabelAlign.gz = "一般工贸";
        }
      }
      if (this.platform("dkaq") || this.platform("xcaq")) {
        if (formLabelAlign.gz == "高危安管") {
          formLabelAlign.gz = "安全管理";
        }
      }
      if (
        this.http.indexOf("bbxdf") != -1 ||
        this.http.indexOf("testtjy") != -1
      ) {
        if (this.formLabelAlign.extra.address == "") {
          return this.$hint.error("所在地区不能为空");
        }
      }
      if (
        this.platformAnhui() &&
        formLabelAlign.gz != "一般工贸" &&
        !formLabelAlign.extra.企业性质
      ) {
        return this.$hint.error("请选择企业性质");
      }
      if (
        this.platformAnhui() &&
        formLabelAlign.gz == "特种作业" &&
        !formLabelAlign.extra.注意事项
      ) {
        return this.$hint.error("注意事项请签名");
      }
      if (formLabelAlign.extra) {
        formLabelAlign.extra = JSON.stringify(formLabelAlign.extra);
      }
      if (formLabelAlign.cert) {
        formLabelAlign.cert = JSON.stringify(formLabelAlign.cert);
      }
      if (this.platform("bosheng") && formLabelAlign.gz == "燃气从业人员培训") {
        if (!formLabelAlign.dep) {
          return this.$hint.error("请选择燃气主管部门");
        }
      }
      if (
        (this.platform("hzdpx") ||
          this.platform("xtaq") ||
          (this.platform("zcaq") && formLabelAlign.gz == "大培训")) &&
        !formLabelAlign.codeChk
      ) {
        return this.$hint.error("请输入验证码");
      }
      let IDCard =
        /^[1-9]\d{5}(17|18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9X]$/; //身份证号校验
      let phone = /^1[3456789]\d{9}$/; //手机号校验
      // return
      for (
        let i = 0;
        i < this.fromList.filter((item) => !item.fitaber).length;
        i++
      ) {
        let items = this.fromList.filter((item) => !item.fitaber)[i];
        if (
          items.field_id == "exam_type" ||
          items.field_type == "download" ||
          items.field_id == "extra"
        ) {
          continue;
        }
        if (
          Boolean(items.selected) &&
          !formLabelAlign[items.field_id] &&
          items.field_id != "cert" &&
          items.passShow
        ) {
          if (items.field_id == "id_card") {
            if (!formLabelAlign["id_card_photo"]) {
              this.$hint.error("身份证人像面" + "不能为空");
              return;
            }
            if (!formLabelAlign["id_card_emblem"]) {
              this.$hint.error("身份证国徽面" + "不能为空");
              return;
            }
            continue;
          }
          this.$hint.error(items.label + "不能为空");
          return;
        }
        if (
          Boolean(items.selected) &&
          items.field_id == "cert" &&
          items.passShow
        ) {
          let obj = JSON.parse(formLabelAlign[items.field_id]);
          if (
            !formLabelAlign[items.field_id] ||
            formLabelAlign[items.field_id] == "[]"
          ) {
            this.$hint.error(items.label + "不能为空");
            return;
          }
          let list = JSON.parse(items.options);
          for (let j = 0; j < list.length; j++) {
            if (!obj[list[j].label]) {
              this.$hint.error(list[j].label + "不能为空");
              return;
            }
          }
        }
        if (
          items.field_id == "username" &&
          Boolean(items.selected) &&
          !IDCard.test(formLabelAlign.username)
        ) {
          this.$hint.error("身份证不合法");
          return;
        }
        if (
          items.field_id == "phone" &&
          Boolean(items.selected) &&
          !phone.test(formLabelAlign.phone)
        ) {
          this.$hint.error("手机号码不合法");
          return;
        }
        if (
          Boolean(items.selected) &&
          items.field_type == "datetimeRange" &&
          items.passShow
        ) {
          if (!formLabelAlign[items.field_id][0]) {
            return this.$hint.error(items.label + "开始时间不能为空");
          }
          if (!formLabelAlign[items.field_id][1]) {
            return this.$hint.error(items.label + "结束时间不能为空");
          }
        }
        if (items.field_type == "datetimeRange") {
          formLabelAlign[items.field_id] = JSON.stringify(
            formLabelAlign[items.field_id]
          );
        }
      }
      if (formLabelAlign.dep) {
        formLabelAlign.dep = formLabelAlign.depid;
      }
      if (formLabelAlign.last_cert) {
        formLabelAlign.last_cert = JSON.stringify([formLabelAlign.last_cert]);
      }
      this.loading = true;
      applyAdd(formLabelAlign).then((res) => {
        this.loading = false;
        if (res.code == 200) {
          if (this.setting.PCwxpay == "是") {
            // 判断是否有在线缴费的权限
            if (Number(this.subjectItem.price)) {
              //判断该科目是否是在线缴费
              let obj = { applyid: res.data.applyid };
              if (this.http.indexOf("yzza") != -1) {
                obj = { applyid: res.data.applyid, order_type: "报名" };
              }
              maPay(obj).then((res) => {
                if (res.return_msg == "OK") {
                  qrcode({ str: res.code_url }).then((resA) => {
                    if (resA.code == 200) {
                      this.$confirm(
                        `<img src='${resA.data.url}' />`,
                        "请使用微信扫码交费，交费成功后即可开通培训权限进行学习",
                        {
                          dangerouslyUseHTMLString: true,
                          center: true,
                          confirmButtonText: "我已缴费",
                          beforeClose: (action, instance, done) => {
                            if (action == "confirm") {
                              H5PayList(obj).then((resB) => {
                                if (resB.code == 200) {
                                  if (resB.data != "支付成功") {
                                    this.$message.error(
                                      resB.data + ",请联系管理员"
                                    );
                                  } else {
                                    this.$message.success(
                                      "支付成功,2秒后自动跳转至登录页面"
                                    );
                                    setTimeout(() => {
                                      window.open(this.http + "/user", "_self");
                                    }, 2000);
                                    done();
                                  }
                                } else {
                                  Message.error(resB.msg);
                                }
                              });
                            } else {
                              done();
                            }
                          },
                        }
                      );
                    }
                  });
                }
              });
            } else {
              this.$confirm(
                "报名成功，管理员审核成功后即可开通培训权限",
                "提示",
                {
                  confirmButtonText: "确定",
                  cancelButtonText: "取消",
                  type: "success",
                  showClose: false,
                }
              )
                .then(() => {
                  this.$router.push("/");
                })
                .catch(() => {});
            }
          } else {
            this.$confirm(
              this.platform("hzdpx") ||
                this.platform("xtaq") ||
                (this.platform("zcaq") && formLabelAlign.gz == "大培训")
                ? "报名成功"
                : "报名成功，管理员审核成功后即可开通培训权限",
              "提示",
              {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "success",
                showClose: false,
              }
            )
              .then(() => {
                if (
                  this.platform("hzdpx") ||
                  this.platform("xtaq") ||
                  (this.platform("zcaq") && formLabelAlign.gz == "大培训")
                ) {
                  window.open(
                    this.http +
                      "/user/#/login?username=" +
                      formLabelAlign.username,
                    "_self"
                  );
                } else {
                  this.$router.push("/");
                }
              })
              .catch(() => {});
          }
        } else {
          this.$message.error(res.msg);
        }
      });
    },
    lazyLoad(node, resolve) {
      let id = node.data ? node.data.region_id : 0;
      regionList({ region_pid: id }).then((res) => {
        resolve(res.data.list);
      });
    },
    //点击日期输入框
    clickInput(data) {
      data.placeholder[1] = null;
      this.$forceUpdate();
      this.$nextTick(() => {
        this.$refs.updataDatePicker[0].$el
          .getElementsByTagName("input")[0]
          .focus();
        // this.$refs.updataDatePicker[0].$children[0].$el.click()
      });
    },

    downFuled(files) {
      if (files.length == 0) {
        return this.$hint.error("暂无附件下载~");
      }
      files.map((item) => {
        download(item.src, item.name);
      });
    },
  },
  created() {
    this.qyname = this.init.alias;
    this.logo = this.init.logo;
    this.fromList = [];
    apply.created.bind(this)();

    // console.log(this.inputList,'000');
  },
};
</script>

<style lang="scss" scoped>
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-thumb {
  border-radius: 15px;
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-track {
  border-radius: 0;
  background: rgba(0, 0, 0, 0.1);
}
.topBack {
  width: 100%;
  padding: 0 100px;
  height: 65px;
  background: #0841ff;
  .textfull {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}
.bodyFull {
  height: calc(100vh - 65px);
  width: 100%;
  overflow: auto;
  overflow-x: hidden;

  .backFull {
    width: 100%;
    background: url("~@/assets/bmbj.png") no-repeat;
    background-size: 100% 100%;
    min-height: 100%;
    display: flex;
    justify-content: center;
    .form {
      width: 760px;
      margin-top: 35px;
      margin-bottom: 50px;
      background: #fff;
      border-radius: 8px;
      h2 {
        text-align: center;
        padding: 20px 0;
        font-size: 20px;
        border-bottom: 1px #eee solid;
      }
      .contentbox {
        padding: 24px;
        width: 100%;
        .redioBtn {
          padding: 6px 16px;
          background: #eeeeee;
          color: #333;
          border-radius: 4px;
          cursor: pointer;
          display: inline-block;
          &:hover {
            background: #0841ff;
            color: #fff;
          }
        }
        .redioactive {
          background: #0841ff;
          color: #fff;
        }
        &::v-deep {
          .el-input {
            input {
              height: 30px;
              line-height: 30px;
            }
          }
          .el-cascader {
            line-height: 30px;
          }
          .el-input__icon {
            line-height: 30px;
          }
          .el-date-editor--daterange.el-input__inner,
          .el-date-editor--timerange.el-input,
          .el-date-editor--timerange.el-input__inner {
            width: 100%;
            height: 30px;
            line-height: 30px;
            padding: 0 12px;
            // input{
            //     height: 28px;
            //     line-height: 28px;
            // }
            .el-input__icon {
              line-height: 22px;
            }
            .el-range-separator {
              line-height: 22px;
              width: 13%;
            }
          }
          .datetimeRange {
            .el-icon-date {
              display: none;
            }
            .el-input__inner {
              padding: 0 12px;
            }
          }
        }
      }
    }
  }
}
</style>